//
//  E7LogoScene.cpp
//  E7_ENGINE
//
//  Created by cc on 12-2-29.
//  Copyright (c) 2012年 PalmGame. All rights reserved.
//

#include "E7LogoScene.h"

#include "E7FrameExterns.h"
extern CE7GameManager* g_pGameManager ;

CE7LogoScene::CE7LogoScene()
{
    m_pBackSprite = NULL ;
    m_pLogoSprite = NULL ;
}

CE7LogoScene::~CE7LogoScene()
{
    Stop() ;
}

// 循环.
void CE7LogoScene::step(float dt)
{
//    printf("LOGO SCENE: %f , %f\n", m_fTotalTime, dt) ;
    m_fTotalTime += dt ;

    if (2.0f < m_fTotalTime)
    {
        Stop() ;
    }
}

void CE7LogoScene::Start()
{
//    printf("enter logo scene - s\n") ;

    if (S_START == m_eStep)
    {
        return ;
    }

    // init super class propertys.
    m_eStep = S_START ;
    m_fTotalTime = ZERO_FLOAT ;
    m_bIsVisible = true ;
    ///////////////////////////////////

    m_pLogoSprite = new CE7Sprite() ;
    if (IsPad())
    {
        m_pLogoSprite->Init(logo_e7click_none) ;
    }
    else
    {
        m_pLogoSprite->Init(logo_e7click_none_iphone) ;
    }

    addChild(m_pLogoSprite) ;

    schedule(schedule_selector(CE7LogoScene::step)) ;
}

void CE7LogoScene::Stop()
{
    if (S_START != m_eStep)
    {
        return ;
    }

    m_eStep = S_STOP ;

    unscheduleAllSelectors() ;
    removeAllChildrenWithCleanup(false) ; // cleanup flag.

    SAFE_RELEASE(m_pBackSprite) ;
    SAFE_RELEASE(m_pLogoSprite) ;

    m_fTotalTime = INVALID_FLOAT ;
    m_bIsVisible = false ;

    g_pGameManager->ChangeSceneState(SS_MENU) ;

//    printf("change to loading scene\n") ;
}











